<template>
  <div>
    <table border="1" cellspacing="0">
      <colgroup span="4" width="200px"></colgroup>
      <tr>
        <td>图片</td>
        <td>标题</td>
        <td>价格</td>
      </tr>

      <tr v-for="i in goods" :key="i.id">
        <td>
          <img :src="baseUrl+i.goods.img" />
        </td>
        <td>{{i.goods.title}}</td>
        <td>{{i.goods.price2}}</td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      baseUrl: "http://127.0.0.1:8000/static/",
      goods: [],
      uid: 0
    };
  },
  mounted() {
    this.uid = localStorage.getItem("uid");
    if (!this.uid) {
      this.$router.push("/login");
    }
    this.axios({
      url: "http://127.0.0.1:8000/app01/order/",
      method: "get",
      params: { uid: this.uid }
    }).then(res => {
      this.goods = res.data;
    });
  }
};
</script>

<style>
</style>